﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using KMS.Core.domain.model.alert;

namespace KMS.Web.Views.News
{
    public class SystemAlertViewModel : AlertViewModel
    {
        public string DisplayedText
        {
            get
            {
                if (DisplayReadMore)
                    return _systemAlert.Message.Substring(0, _displayChars) + "...";
                else
                    return _systemAlert.Message;
            }
        }

        public string FullText
        {
            get
            {
                return _systemAlert.Message;
            }
        }

        public bool DisplayReadMore
        {
            get
            {
                return _systemAlert.Message.Length > _displayChars;
            }
        }

        private int _displayChars;
        private SystemAlert _systemAlert;

        public SystemAlertViewModel(SystemAlert systemAlert, int displayChars) : base(systemAlert)
        {
            _systemAlert = systemAlert;
            _displayChars = displayChars;
        }
    }
}
